package com.wisdytech.common.bean;

/**
 * 查询标准返回值
 * @author dlb
 *
 */
public class StandardMsgResult <T> extends StandardMsg {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8505478066261459590L;
	
	/**返回数据*/
	private T data;
	
	public StandardMsgResult() {
		super();
	}
	
	/**
	 * 获取标准正确返回值
	 * @param data
	 * @return
	 */
	public  static <T> StandardMsgResult<T>  getSuccessMsgResult(T data) {
		StandardMsgResult<T> result =new StandardMsgResult<T>();
		result.setCode(ResultEnum.SUCCESS.getCode());
		result.setResult(true);
		result.setMessage(ResultEnum.SUCCESS.getMessage());
		result.setData(data);
		return result;
	}
	
	/**
	 * 获取标注错误返回值
	 * @return
	 */
	public static <T> StandardMsgResult<T> getFailMsgResult(ResultEnum resultEnum) {
		StandardMsgResult<T> result =new StandardMsgResult<T>();
		result.setResult(false);
		result.setCode(resultEnum.getCode());
		result.setMessage(resultEnum.getMessage());
		return result;
	}
	
	

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
	
	

}
